/**
 * Description: 手卫生记录Api
 *
 * Created by hrx on 2023/9/18
 */
import service, {IResponseArrayDto, IResponseDto} from "@/utils/ajax";
// import ServerController from "@/utils/server-controller";
// import type { IResponseDto } from "@/utils/request";
import type {IBaseQueryDataListParams} from "@/api/index"
import {AxiosResponse} from "axios";


export interface queryHandHygieneRecordListData {
  startTime?: string,
  endTime?: string,
  userName?: string,
  washHandsType?: number,
  finishFlag?: number,
  timeList?: Array<Date>,
  deptIdArrayList?: Array<Array<number>>
}



export interface handHygieneRecordDTO {
  id?: number,
  washHandsRecordCode?: string,
  deviceCode?: string,
  subUserName?: string,
  hospitalDeptName?: string,
  washHandsType?: number,
  deviceLocation?: string,
  deviceRegion?: string,
  devicePosition?: string,
  finishFlag?: number,
  washHandsScore?: string,
  washHandsDuration?: number,
  resultDesc?: string,
  startTime?: string,
  endTime?: string,
  washHandsTypeStr?: string,
  finishFlagStr?: string,
  deviceRegionOrPosition?: string,
  washHandsDurationStr?: string,
  washHandsRecordId?: number,
  tableData?: Array<any>
}

export interface handHygieneRecordDetailDTO {
  key?: string,
  stepStatus?: string,
  stepImagePath?: string,
  stepErrMsg?: string,
  children?: Array<washHandsStepVODTO>,
  actionErrorDesc?: string,
  actionStage: number ,
  actionStatus?: number,
  stepImageUrl?: string,
  stepName?: string,
  stepNum?: string,
  level?: number,
  washHandsDuration?: string,
  washHandsStepVOList?: Array<washHandsStepVODTO>
}
export interface washHandsStepVODTO{
  key: string,
  level: number,
}

export interface queryDetailParamDTO {
  id?: number,
  washHandsType?: number
}

export function getHandHygieneRecordListApi(data: IBaseQueryDataListParams<queryHandHygieneRecordListData>): Promise<AxiosResponse<IResponseDto<IResponseArrayDto<handHygieneRecordDTO>>>> {
  return service({
    url: '/cloud/washHands/record/queryPage',
    method: "post",
    data,
    headers: {
      "showLoading": true
    },
  })
}

export function getOrdinaryTypeStepDetailApi(data: queryDetailParamDTO): Promise<AxiosResponse<IResponseDto<Array<handHygieneRecordDetailDTO>>>> {
  return service({
    url: '/cloud/washHands/record/ordinaryTypeStep',
    method: "post",
    data,
    headers: {
      "showLoading": true
    },
  })
}

export function getSurgeryTypeStepDetailApi(data: queryDetailParamDTO): Promise<AxiosResponse<IResponseDto<Array<handHygieneRecordDetailDTO>>>> {
  return service({
    url: '/cloud/washHands/record/surgeryTypeStep',
    method: "post",
    data,
    headers: {
      "showLoading": true
    },
  })
}

export function exportDataApi(data: IBaseQueryDataListParams<queryHandHygieneRecordListData>):  Promise<AxiosResponse<IResponseDto>> {
  return service({
    url: '/cloud/washHands/record/export',
    method: "post",
    data,
    responseType: 'blob',
    headers: {
      "showLoading": true,
      "Content-Type":"application/json"
    },
  })
}

// export const getHandHygieneRecordListApi = (params: queryHandHygieneRecordListParam): Promise<IResponseDto> =>
//   ServerController.getInstance().getAjax().request({
//     url: '/cloud/washHands/record/queryPage',
//     method: 'post',
//     params,
//     headers: {
//       "Content-Type": "application/json;charset=utf-8",
//     },
//     showLoading: true
//   });